import unittest

from util.HTMLTestRunner import HTMLTestRunner

if __name__ == '__main__':
    path = ".\\"
    filename = "case*.py"
    s1 = unittest.defaultTestLoader.discover(path, filename)
    # 只能生成文字版本报告
    # r1 = unittest.TextTestRunner(verbosity=2)
    # 生成html报告
    # wb 用二进制流的形式写
    f = open('..\\report\\result.html', 'wb')
    r1 = HTMLTestRunner(f,
                        verbosity=2,
                        title='测试标题',
                        description="测试描述信息")
    r1.run(s1)
    f.close()